package com.supinfo.bonjoursupinfo.fragments;


import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.supinfo.bonjoursupinfo.R;

public class AboutFragment extends Fragment {
	
	public String number = "tel:+33 153359700";
	
	@Override
	public View onCreateView(LayoutInflater inflater, final ViewGroup container,
			Bundle savedInstanceState) {
		
		View view = inflater.inflate(R.layout.about, container, false);

		Button callButton = (Button) view.findViewById(R.id.buttonNumber);
		Button mailButton = (Button) view.findViewById(R.id.buttonMail);
		TextView address = (TextView) view.findViewById(R.id.textLocationContent);
		
		address.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				
			}
		});
		
		callButton.setBackgroundColor(getResources().getColor(R.color.grey));
		mailButton.setBackgroundColor(getResources().getColor(R.color.grey));
		callButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent callIntent = new Intent(Intent.ACTION_CALL);
				callIntent.setData(Uri.parse(number));
				container.getContext().startActivity(callIntent);
				}
			});

		mailButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent mail = new Intent(android.content.Intent.ACTION_SEND); 
				String emailList[] = { "nice@supinfo.com" };
				mail.putExtra(android.content.Intent.EXTRA_EMAIL, emailList);  
				mail.setType("plain/text");  
				container.getContext().startActivity(Intent.createChooser(mail, "Envoyer ce mail avec :"));
			}
		});

		return view;
	}
}
